<!DOCTYPE html>
<html>
<head>
	<title>websocket</title>
</head>
<body>
<input type="" name="" id='inputId'>
<button id='sendId'>发送</button>
<script type="text/javascript">
var ws = new WebSocket("ws://123.207.136.134:9010/ajaxchattest");


ws.onmessage = function(evt) {
	console.log('getMessage');
	console.log(evt);
};

ws.onclose = function(evt) {
	console.log("Connection closed.");
};  
document.getElementById('sendId').onclick = function () {
	let val = document.getElementById('inputId').value;
	console.log(val);
	ws.send(val);
}
</script>
</body>
</html>